Skip to content

[TEP-0056]: Pipelines in Pipelines happy path using PipelineSpec property.#1

Open
twoGiants wants to merge 7 commits intomainfrom
issue-8760-tep-0056-pip-happy-path
Open

[TEP-0056]: Pipelines in Pipelines happy path using PipelineSpec property.#1
twoGiants wants to merge 7 commits intomainfrom
issue-8760-tep-0056-pip-happy-path

Conversation

@twoGiants
Copy link
Owner

Changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@twoGiants twoGiants self-assigned this Jun 9, 2025
@twoGiants twoGiants changed the title [TEP-0056]: Pipelines in Pipelines happy path using PipelineSpec property. 🚧 [TEP-0056]: Pipelines in Pipelines happy path using PipelineSpec property. 🚧 Jun 9, 2025
@twoGiants twoGiants changed the title 🚧 [TEP-0056]: Pipelines in Pipelines happy path using PipelineSpec property. 🚧 🚧 *[TEP-0056]:* Pipelines in Pipelines happy path using PipelineSpec property. 🚧 Jun 9, 2025
@twoGiants twoGiants changed the title 🚧 *[TEP-0056]:* Pipelines in Pipelines happy path using PipelineSpec property. 🚧 🚧 [TEP-0056]: Pipelines in Pipelines happy path using PipelineSpec property. 🚧 Jun 9, 2025
@twoGiants twoGiants force-pushed the issue-8760-tep-0056-pip-happy-path branch 7 times, most recently from f694a52 to 6dcce21 Compare June 16, 2025 12:51
@twoGiants twoGiants force-pushed the issue-8760-tep-0056-pip-happy-path branch 3 times, most recently from 68fe10b to a19b14d Compare June 18, 2025 13:53
@twoGiants twoGiants force-pushed the issue-8760-tep-0056-pip-happy-path branch 15 times, most recently from e1b00f0 to 6fb3c12 Compare July 1, 2025 08:53
@twoGiants twoGiants force-pushed the issue-8760-tep-0056-pip-happy-path branch from 6fb3c12 to 37839ed Compare July 4, 2025 12:49
@twoGiants twoGiants force-pushed the issue-8760-tep-0056-pip-happy-path branch 8 times, most recently from 98949df to 23e000f Compare July 10, 2025 14:37
Copy link
Owner Author

@twoGiants twoGiants Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr-3

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr-3

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr-1

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr-3

@twoGiants twoGiants changed the title 🚧 [TEP-0056]: Pipelines in Pipelines happy path using PipelineSpec property. 🚧 [TEP-0056]: Pipelines in Pipelines happy path using PipelineSpec property. Jul 12, 2025
@twoGiants twoGiants force-pushed the issue-8760-tep-0056-pip-happy-path branch 9 times, most recently from d5324fc to c532220 Compare July 12, 2025 13:45
[TEP-0056]

Child `PipelineRuns` (PinP) are created by the `PipelineRun` reconciler,
equal to the `TaskRun/CustomRun` implementations.

An event handler for child `PipelineRuns` is registered in controller
entrypoint. This will trigger the reconciliation loop when child
`PipelineRuns` change their state.

Extend `ResolvedPipelineTask` data structure to store child
`PipelineRuns` and the resolved pipeline in `ResolvedPipeline` data
structure equal to `ResolvedTask`.

Add `GetPipelineRun` function alias for convenience.

Add condition to `func ResolvePipelineTask` which checks if the given
`PipelineTask` is a `Pipeline` and resolves it by getting the actual
spec. In our "happy path" case it's right on the `PipelineTask` because
we use `PipelineSpec` and don't need to fetch it from anywhere.

A few downstream methods equal to resolving a `TaskRun` were added.

Extend `resolvePipelineState` with getter for child `PipelineRuns` using
lister and extend `runNextSchedulableTask` with a condition check for a
`PipelineTask` which is a `Pipeline` and implement the creation of
a new `PipelineRun` from the resolved pipeline state and pipeline facts.

To get the status of the child `PipelineRun` success and failure checks
were added to the `PipelineRun` types and extended in the resolution
methods. Test were added to cover the new public methods.

Setting the `ChildReferences` was extended for child `PipelineRuns`.

Extract getTask/-Run/Run functions in `pipelinerunresolution_test.go`.
The function declarations were duplicated up to 10 times. Now they are
extracted and generalized to a large extent.

Rename label/annotation factory.

Issues tektoncd#8760, tektoncd#7166.

Signed-off-by: Stanislav Jakuschevskij <[email protected]>
Remove unused code and helper functions from PipelineRun e2e tests.

Fix typos premption => preemption.

Issues tektoncd#8760, tektoncd#7166.

Signed-off-by: Stanislav Jakuschevskij <[email protected]>
Switch to IsChildPipeline method. Fix typos and change wording in docs.

Add child pipeline check to `isFailure`.

Issues tektoncd#8760, tektoncd#7166.
Add mock PipelineRun factory and PipelineRun condition transition
functions.

Now that it also includes child PipelineRuns in its check additional
tests with mock data were added.

Add `getNextTasks` tests.

Now that `DAGExecutionQueue` downstream takes child (PinP) pipelines
into account, additional tests were added.

Now that `GetPipelineConditionStatus` downstream takes child (PinP)
pipelines into account, additional test cases with necessary mock data
were added.

Now that `AdjustStartTime` takes child (PinP) pipelines into account,
additional tests cases were added.

Now that `GetPipelineTaskStatus` takes child (PinP) pipelines into
account, additional test cases were added.

`GetTaskRunsResults` now also skips over child (PinP) pipelines when
getting the TaskRun results. One test case was added to test skipping
the child `PipelineRun`.

Now that `GetChildReferences` takes child (PinP) into account,
additional tests were added.

Issues tektoncd#8760, tektoncd#7166.

Signed-off-by: Stanislav Jakuschevskij <[email protected]>
Now that `getReason` takes child (PinP) into account, additional tests
were added.

This commit does not contain tests for a matrixed task. Those will be
added once the matrix feature for child (PinP) PipelineRuns is
implemented.

Now that `isFailure` takes child (PinP) into account, additional tests
were added.

Now that `isSuccessful` takes child (PinP) into account, additional tests
were added.

Test that the pipeline state contains the resolved child (PinP) pipeline
, the correct child `PipelineRun` name and the child `PipelineRun` if
there is any.

Issues tektoncd#8760, tektoncd#7166.

Signed-off-by: Stanislav Jakuschevskij <[email protected]>
The test setup is a parent pipeline with one or more embedded
child/grandchild pipelines using the `PipelineSpec` (alpha) field. It
follows the given-when-then test flow arrangement.

The pipeline manifests yaml definitions use variables for every field
which is validated. Multiple helper functions were created equal to
reconciliation unit tests for TaskRuns/CustomRuns:
- `testing.OnePipelineInPipeline`
- `testing.TwoPipelinesInPipelineMixedTasks`
- `testing.NestedPipelinesInPipeline`
- `parse.MustParseChildPipelineRunWithObjectMeta`
- `reconcileOncePinP`
- `validatePinP`
- `getChildPipelineRunsForPipelineRun`
- `getChildPipelineRunByName`
- `validateChildPipelineRunCount`
- `getChildPipelineRunByName`
- `testing.VerifyChildPipelineRunStatusesCount`
- `testing.VerifyChildPipelineRunStatusesNames`
- `testing.childPipelineRunWithObjectMeta`

Test data factory functions were put in the `testing` package in the
`factory.go` file.

The test validates:
- the status and condition of the parent PipelineRuns which should
trigger the creation of the child PipelineRuns,
- the actual created child/grandchild PipelineRuns if they have the correct
metadata i.e. name, owner reference, etc. and the embedded pipelines
from the `PipelineSpec` fields in the pipeline tasks of the parent
pipeline.

Similar checks are performed in `TestReconcile` for `TaskRun` and in
`TestReconcile_V1Beta1CustomTask` for `CustomTasks`.

Add annotations/label propagation tests:
- `TestReconcile_PropagateLabelsAndAnnotationsToChild`
- `TestReconcile_ChildPipelineRunHasDefaultLabels`

Aadd child pipeline creation error tests. New table driven test
`TestReconcile_ChildPipelineRunCreationError` and test framework
additions:
- `type clientErrors`
- `reconcileWithError`

`reconcileWithError` can be reused in every test with fake client error
returns i.e. where `Pipeline.PrependReactor` is used.

Add e2e child pipeline tests. The test setup is a parent pipeline with
one or more embedded child/grandchild pipelines using the `PipelineSpec`
(alpha) field equal to the reconciliation unit tests. The e2e tests also
follow the Given-When-Then test structure.

The pipeline manifests yaml definitions use variables for every field
which is validated. Multiple helper functions were created equal to
PipelineRun e2e tests:
- `setupPinP`
- `tearDownOptDump`
- `createKindsMap`
- `assertPinP`
- `createResourcesAndWaitForPipelineRun`
- `checkLabelPropagationToChildPipelineRun`
- `checkAnnotationPropagationToChildPipelineRun`
- `assertEvents`

The tests validate:
- parent PipelineRun creation,
- child PipelineRun creation,
- successful finish of all resources,
- correct label and annotation propagation,
- amount of events published.

Similar checks are performed in
`TestPipelineRun|TestPipelineRunStatusSpec|...` for `TaskRun` and in
`TestCustomTask` for `CustomTask`.

Issues tektoncd#8760, tektoncd#7166

Signed-off-by: Stanislav Jakuschevskij <[email protected]>
@twoGiants twoGiants force-pushed the issue-8760-tep-0056-pip-happy-path branch from c532220 to 85ce1b3 Compare July 23, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant